﻿using System.ComponentModel.Composition;
using WafApplication1.Applications.Services;
using WafApplication1.Applications.ViewModels;

namespace WafApplication1.Applications.Controllers
{
    [Export]
    internal class HouseTypeController
    {
        private readonly IShellService shellService;
        private readonly HouseTypeViewModel houseTypeViewModel;
        private readonly PageViewModel pageViewModel;

        [ImportingConstructor]
        public HouseTypeController(IShellService shellService, HouseTypeViewModel houseTypeViewModel, PageViewModel pageViewModel)
        {
            this.shellService = shellService;
            this.houseTypeViewModel = houseTypeViewModel;
            this.pageViewModel = pageViewModel;
            this.houseTypeViewModel.PageViewModel = pageViewModel; // 关键
        }

        public void Initialize()
        {
            shellService.HouseTypeView = houseTypeViewModel.View;
            // 添加子页面的方法
            this.houseTypeViewModel.AddPageView();
        }

    }
}
